Hi, |
Re: Triggers Triggers are stored in a Module, a Project, or the Database. In this case you will want to deploy the trigger in the folder's parent Project, but the trigger code itself checks the folder and if its not the right one, just stops. So if its a module level trigger then you can get the module name and make sure its prefix is the name of the project combined with the name of the folder. NameFolder = "MyTriggerFolder" NamePath = "/" name(current Project "/" NameFolder NameMod = name(module(current Trigger)) if (length(NameMod) > length(NamePath) and NameMod0:length(NamePath)-1 == NamePath) // then Trigger applies to this module else Trigger does not apply. Do nothing. .... trigger(NameTrigger, project->module->formal, post, open 6, DXLCode)
Well, actually "Almost". Select the folder in the right pane and use the File menu to convert it to a project. Open it up and deploy your trigger. Go back with it in the right pane and convert it back to a folder. Seems to be working sometimes. DISCLAIMER: the hackles on the back of my neck are up; that goodness I'm getting sporadic Exception Violations forcing the abandonment of this violation of the laws of the universe. Not checking it out closely but I suspect the Trigger is already loaded on the Client but there are hiccups using a Trigger for a Project that no longer exists. It seems at one point the Trigger was sucessfully moved up into the higher Project. |
Re: Triggers Thus you would have to open each module and store the module level trigger in each module in the folder. |
Re: Triggers OurGuest - Tue Aug 09 09:12:45 EDT 2011
This is not the first time the manual is wrong. They recently upgraded the Trigger help section and now its "bad" instead of "abysmal".
string DXLCode =
" set(trigPreConPass)
Trigger trg = current; if (null trg) halt() // Error?
AttrDef ad = attrdef(trg); if (null ad) halt() // Error?
string Name = ad.name
if (Name == \"Object Text\") infoBox(\"Text change detected in Trigger\")
" // end string DXLCode
string NameTrig = "DetectTextChange"
Trigger trg
for trg in (current Project) do
{ if (name(trg) == NameTrig and
confirm("Delete trig '" NameTrig "'??"))
{ delete(trg)
halt // or break
}
}
if (confirm("Create trigger '" NameTrig "' in project??"))
{ trigger(NameTrig, project->module->all->attribute,
pre, save, 5, DXLCode)
}
|